<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
    xmlns:p="http://primefaces.prime.com.tr/ui" template="/layout/principal.xhtml">

    <ui:define name="content">

        <h1 class="title ui-widget-header">
            <h:outputText value="Modificar Campaña" />
        </h1>

        <h:form>
            <p:growl id="growl" showDetail="true" life="3000" />
            <p:panel>
                <p:focus />
                <h:panelGrid columns="6" cellspacing="5" cellpadding="5">
                    <h:panelGrid columns="2" cellspacing="5" cellpadding="5">
                        <h:outputLabel value="Nombre : *" for="nombreId" />
                        <p:inputText id="nombreId" value="#{campaign.selectedCampaign.nombre}" required="true"
                            style="width: 200px;" />

                        <h:outputLabel value="Intentos : * " for="intentosId" />
                        <p:inputText id="intentosId" value="#{campaign.selectedCampaign.intentos}" required="true"
                            style="width: 200px;">
                            <f:convertNumber integerOnly="true" />
                        </p:inputText>
                    </h:panelGrid>

                    <p:spacer width="50" height="10" />
                    <h:outputText value="Rango Fechas : " />

                    <h:panelGrid columns="2" cellspacing="5" cellpadding="5">
                        <h:outputLabel value="Start : * " for="starId" />
                        <p:calendar id="starId" value="#{campaign.selectedCampaign.fchInicio}" effect="drop"
                            readOnlyInputText="true" pattern="yyyy/MM/dd HH:mm" required="true" style="width: 200px;" />

                        <h:outputLabel value="End : * " for="endId" />
                        <p:calendar id="endId" value="#{campaign.selectedCampaign.fchFinal}" effect="drop"
                            readOnlyInputText="true" pattern="yyyy/MM/dd HH:mm" required="true" style="width: 200px;" />
                    </h:panelGrid>

                    <h:panelGrid columns="2" cellspacing="5" cellpadding="5">
                        <h:outputLabel value="Script : " for="scriptId" />
                        <p:inputTextarea id="scriptId" value="#{campaign.selectedCampaign.script}" rows="5" cols="60"
                            effectDuration="400" />
                    </h:panelGrid>
                </h:panelGrid>
                <p:separator />
                <h:panelGrid columns="4" cellspacing="5" cellpadding="5">
                    <h:outputLabel value="Formulario : " for="pickListId" />
                    <p:pickList id="pickListId" value="#{campaign.listFormulario}" var="f" itemLabel="#{f.nombre}"
                        itemValue="#{f}" converter="formConverter" addAllLabel="Adicionar Todos" addLabel="Adicionar"
                        removeAllLabel="Remover Todos" removeLabel="Remover" effect="fade" immediate="true"
                        valueChangeListener="#{campaign.change}">
                        <f:facet name="sourceCaption">
                            <h:outputText value="Disponible" />
                        </f:facet>
                        <f:facet name="targetCaption">
                            <h:outputText value="Seleccionado" />
                        </f:facet>
                    </p:pickList>
                </h:panelGrid>
            </p:panel>

            <p:panel header="Opciones">
                <h:panelGrid columns="2">
                    <p:commandButton value="Actualizar" action="#{campaign.actualizar}" update="growl"
                        style="width: 200px;" />
                    <p:commandButton value="Cancelar" action="goListarCampaign" ajax="false" immediate="true"
                        style="width: 200px;" />
                </h:panelGrid>
            </p:panel>
        </h:form>

    </ui:define>
</ui:composition>